package core;

/**
 * Created with IntelliJ IDEA.
 * User: lahiru
 * Date: 3/27/14
 * Time: 8:01 PM
 * To change this template use File | Settings | File Templates.
 */
public class PhoneWrapper {
    private Phone phone;
    private int count = 0;
    private double vector[];
    private int id;

    public PhoneWrapper(Phone phone) {
        this.phone = phone;
        this.count = phone.getCount();
        this.vector = phone.getVector();
        this.id = phone.getId();

    }

    public void addActivations(double[] newVector) throws NumberFormatException {
        if (newVector.length != vector.length) {
            throw new NumberFormatException();
        }
        for (int i = 0; i < vector.length; i++) {
            vector[i] = vector[i] + newVector[i];
        }
    }

    public int getId() {
        return id;
    }

    public Phone getPhone() {
        return phone;
    }

    public int getCount() {
        return count;
    }

    public void increaseCount(int value) {
        this.count = count + value;
    }

    public double[] getVector() {
        return vector;
    }

    public void averageVector() {
        for (int i = 0; i < vector.length; i++) {
            vector[i] = vector[i] / count;
        }
    }
}
